package com.xxwy.bean;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author wy
 * @date 2020/4/21 14:42
 */
public class DefaultUserFactory implements UserFactory , InitializingBean, DisposableBean {

  @PostConstruct
  public void init(){
    System.out.println("PostConstruct init DefaultUserFactory");
  }

  @PreDestroy
  public void destory(){
    System.out.println("PreDestroy dispose DefaultUserFactory");
  }

  public void initUserFactory(){
    System.out.println("initMethod 自定义初始化方法 ");
  }

  public void destroyUserFactory(){
    System.out.println("destroyUserFactory 自定义销毁方法方法 ");
  }
  @Override
  public void afterPropertiesSet() {
    System.out.println("InitializingBean afterPropertiesSet");
  }

  public DefaultUserFactory() {
    System.out.println("DefaultUserFactory 实例化");
  }

  @Override
  public void destroy() {
    System.out.println("DisposableBean  destroy");
  }

  @Override
  protected void finalize() throws Throwable {
    System.out.println("======GC调用了=========");
  }
}
